/*
 * GeoVISTA Center (Penn State, Dept. of Geography)
 * Copyright (c), 2003-2011,  Jin Chen and Alan M. MacEachren, GeoVISTA Center, Penn State University
 * Licensed under Simplified BSD License
 *
 *
 * @author: jin Chen 
 * @date: Sep 24, 2004$
 * @version: 1.0
 */
package edu.psu.geovista.app.pcp.plot.gui;

import edu.psu.geovista.app.pcp.Pcp;
import edu.psu.geovista.app.pcp.plot.control.AppearanceCfg2;
import edu.psu.geovista.app.pcp.plot.control.ConfigManager;
import edu.psu.geovista.app.pcp.plot.control.gui.PlotStrechSection;
import edu.psu.geovista.app.pcp.plot.control.tools.AxisPlaceTool;
import edu.psu.geovista.app.pcp.plot.control.tools.BasicTool;
import edu.psu.geovista.app.plot.axis.AxisList;

import javax.swing.*;
import javax.swing.plaf.ComponentUI;

public class LightPcpUI extends BasicPcpUI {

    public LightPcpUI(Pcp plot) {
        super(plot);
    }
    public void installUI(JComponent c) {
           this.installComponent(c);
            //this.pcp =pcp
    }
     /**
     * Swing method. Returns a new instance.
     */
    public static ComponentUI createUI(JComponent c) {
        return new LightPcpUI((Pcp)c);
    }
    public void feedData(edu.psu.geovista.data.model.AppDataModel dataModel) {
       super.feedData(dataModel);
        AxisPlaceTool cmd = (AxisPlaceTool) this.getToolsMgr().getCmd(BasicTool.AxisPlaceT);
        AxisList yaxisList = this.getPlot().getYaxisList();
        //List axisNameList = yaxisList.getAxisNameList();
        /*int len=4;
        String names[]=new String[len];
        boolean visible[]=new boolean[len];
        for (int i=0;i<len;i++){
            names[i]=yaxisList.getAxis(i).getName() ;
            visible[i]=true;
        }
        cmd.setYAxisAsValid(names,visible);*/

    }
    //customize config setting
    protected  void customize(ConfigManager config) {
        //light pcp contain only limited # of axes, thus need always fit to window
        AppearanceCfg2 locCfg = (AppearanceCfg2) config.getCfg(ConfigManager.CFG_APPEARANCE);
        PlotStrechSection plotStretchSection = locCfg.getPlotStretchSection();
        plotStretchSection.setFillHorizontally(true);
        plotStretchSection.setFillVertically(true);
    }
}
